/*
 * @Date         : 2022-06-09 23:30:20
 * @LastEditors  : zu1662
 * @LastEditTime : 2022-06-29 15:15:00
 * @Description  : 文章分页数据对象
 * 
 * Copyright © 2022 by zu1662, All Rights Reserved. 
 */
import { PaginationListAbstract } from "src/utils/pagination/pagination.abstract";
import { PaginationAvailableSearch, PaginationAvailableSort, PaginationPage, PaginationPerPage, PaginationSearch, PaginationSort } from "src/utils/pagination/pagination.decorator";
import { IPaginationSort } from "src/utils/pagination/pagination.interface";

export class ArticleListDto implements PaginationListAbstract {
  @PaginationSearch() // 搜索字段
  readonly search: string;

  readonly status: 'draft'| 'publish'; // 文章状态

  @PaginationAvailableSearch(["title", 'summary']) // 可用搜索字段
  readonly availableSearch: string[];

  @PaginationPage(1) // 页码
  readonly page: number;

  @PaginationPerPage(20) // 分页条数
  readonly perPage: number;

  @PaginationSort("publishAt@desc", ["createAt", "publishAt"]) // 排序字段
  readonly sort: IPaginationSort;

  @PaginationAvailableSort(["createAt", "publishAt"]) // 可用排序字段
  readonly availableSort: string[];
}
